<template>
    <div>
        <el-form :inline="true" :model="searchForm">
            <el-form-item label="">
                <el-input
                    size="small"
                    v-model="searchForm.name"
                    prefix-icon="el-icon-search"
                    placeholder="请输入函数名称"
                    clearable
                />
            </el-form-item>
            <el-form-item>
                <el-button size="small" type="primary" @click="search">搜索</el-button>
                <el-button size="small" @click="reset">重置</el-button>
            </el-form-item>
        </el-form>
        <el-table :data="dataList">
            <el-table-column type="index"></el-table-column>
            <el-table-column prop="name" label="名称"></el-table-column>
            <el-table-column prop="expression" label="表达式"></el-table-column>
            <el-table-column prop="description" label="描述"></el-table-column>
            <el-table-column prop="type" label="类型"></el-table-column>
        </el-table>
        <el-pagination layout="prev, pager, next" @current-change="onCurrentChange" :total="total" />
    </div>
</template>
<script>
export default {
    comments: {},
    data() {
        return {
            searchForm: {
                current: 1,
                size: 10,
                name: ""
            },
            dataList: [],
            total: 0
        }
    },
    created() {
        this.getDataList()
    },
    mounted() {},
    methods: {
        getDataList() {
            const url = `/nore/autotest/function/list/${this.searchForm.current}/${this.searchForm.size}`
            this.$post(url, this.searchForm, response => {
                console.log(response)
                if (response.status === 0) {
                    this.total = response.data.total
                    this.dataList = response.data.list
                }
            })
        },
        onCurrentChange(current) {
            this.searchForm.current = current
            this.dataList = []
            this.getDataList()
        },
        search() {
            this.getDataList()
        },
        reset() {
            this.searchForm.name = "";
            this.getDataList()
        }
    }
}
</script>
<style></style>